#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <float.h>

#define LIST 129

#if (LIST == 125)
// 1-25 extern使用示例
int max(int x,int y);
int main(void)
{
    int result;
    /*外部变量声明*/
    extern int g_X;
    extern int g_Y;
    result = max(g_X,g_Y);
    printf("the max value is %d\n",result);
    return 0;
}
/*定义两个全局变量*/
int g_X = 10;
int g_Y = 20;
int max(int x, int y)
{
    return (x>y ? x : y);
}



#elif (LIST == 126)
// 1-26 main.c
#include <stdio.h>
/*定义两个全局变量*/
int g_X=10;
int g_Y=20;
int max();
int main(void)
{
    int result;
    result = max();
    printf("the max value is %d\n",result);
    return 0;
}

#elif (LIST == 127)
// 1-27 静态局部变量使用示例
void count();
int main(void)
{
    int i=0;
    for (i = 0; i <= 5; i++)
    {
        count();
    }
    return 0;
}
void count()
{
    /* 声明一个静态局部变量 */
    static num = 0;
    num++;
    printf("%d\n",num);
}

#elif (LIST == 128)
// 1-28 默认为0的演示示例
static int g_x;
int g_y;
int main(void)
{
    static int x;
    printf("g_x:%d\ng_y:%d\nx:%d",g_x,g_y,x);
    return 0;
}

#elif (LIST == 129)
// 1-29 register变量的使用示例
size_t fac(size_t n);
int main(void)
{
    size_t i;
    for(i=1; i<=5; i++)
    {
        printf("%d! = %d\n",i,fac(i));
    }
    return 0;
}
size_t fac(size_t n)
{
    register size_t result=1;
    register size_t i=1;
    for(i=1; i<=n; i++)
    {
        result = result*i;
    }
    return result;
}

#endif